/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prognosisdataalgo;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ApT
 */
public class Coordinate {

    private LatLng coordinate;
    private String name;
    private double value;
    private double factorsValue;
    private double lowImpactValue;
    private double distanceImpactValue;
    private double allImpactValue;
    private double afterFuzzyImpactValue = 0;
    private double dayFactorValue;
    private double allCalculateResult = 0;
    /*
     * Fuzzy factors names
     */
    private String distanceFuzzy = "";
    private String negativeFactorsFuzzy = "";
    private String valuesFuzzy = "";
    private String resultFuzzy = "";
    /*
     * Fuzzy value database
     */
    private double distanceValueFuzzy = 0;
    private double negativeFactorsDistanceValueFuzzy = 0;
    /*
     * Result Fuzzy Additional
     */
    private double fuzzyCorrectifyValue = 0;
    /*
     * Days factors
     */
    private Map<String, Integer> daysMap;

    public Coordinate(LatLng coordinate, String name, double value) {
        this.coordinate = coordinate;
        this.name = name;
        this.value = value;
        lowImpactValue = 0;
        distanceImpactValue = 0;
        allImpactValue = 0;
        daysMap = new HashMap<String, Integer>();
    }

    public LatLng getCoordinate() {
        return coordinate;
    }

    public String getName() {
        return name;
    }

    public double getValue() {
        return value;
    }

    public double getFactorsValue() {
        return factorsValue;
    }

    public void setFactorsValue(double factorsValue) {
        this.factorsValue = factorsValue;
    }

    public double getLowImpactValue() {
        return lowImpactValue;
    }

    public void setLowImpactValue(double lowImpactValue) {
        this.lowImpactValue = lowImpactValue;
    }

    public void addToLowImpactValue(double lowImpactValue) {
        this.lowImpactValue += lowImpactValue;
    }

    public double getDistanceImpactValue() {
        return distanceImpactValue;
    }

    public void setDistanceImpactValue(double distanceImpactValue) {
        this.distanceImpactValue = distanceImpactValue;
    }

    public double getAllImpactValue() {
        return allImpactValue;
    }

    public void setAllImpactValue(double allImpactValue) {
        this.allImpactValue = allImpactValue;
    }

    public double getDayFactorValue() {
        return dayFactorValue;
    }

    public void setDayFactorValue(double dayFactorValue) {
        this.dayFactorValue = dayFactorValue;
    }

    public String getDistanceFuzzy() {
        return distanceFuzzy;
    }

    public void setDistanceFuzzy(String distanceFuzzy) {
        this.distanceFuzzy = distanceFuzzy;
    }

    public String getNegativeFactorsFuzzy() {
        return negativeFactorsFuzzy;
    }

    public void setNegativeFactorsFuzzy(String negativeFactorsFuzzy) {
        this.negativeFactorsFuzzy = negativeFactorsFuzzy;
    }

    public String getValuesFuzzy() {
        return valuesFuzzy;
    }

    public void setValuesFuzzy(String valuesFuzzy) {
        this.valuesFuzzy = valuesFuzzy;
    }

    public double getDistanceValueFuzzy() {
        return distanceValueFuzzy;
    }

    public void setDistanceValueFuzzy(double distanceValueFuzzy) {
        this.distanceValueFuzzy = distanceValueFuzzy;
    }

    public double getNegativeFactorsDistanceValueFuzzy() {
        return negativeFactorsDistanceValueFuzzy;
    }

    public void setNegativeFactorsDistanceValueFuzzy(double negativeFactorsDistanceValueFuzzy) {
        this.negativeFactorsDistanceValueFuzzy = negativeFactorsDistanceValueFuzzy;
    }

    public double getAfterFuzzyImpactValue() {
        return afterFuzzyImpactValue;
    }

    public void setAfterFuzzyImpactValue(double afterFuzzyImpactValue) {
        this.afterFuzzyImpactValue = afterFuzzyImpactValue;
    }

    public double getFuzzyCorrectifyValue() {
        return fuzzyCorrectifyValue;
    }

    public void setFuzzyCorrectifyValue(double fuzzyCorrectifyValue) {
        this.fuzzyCorrectifyValue = fuzzyCorrectifyValue;
    }

    public String getResultFuzzy() {
        return resultFuzzy;
    }

    public void setResultFuzzy(String resultFuzzy) {
        this.resultFuzzy = resultFuzzy;
    }

    public double getAllCalculateResult() {
        return allCalculateResult;
    }

    public void setAllCalculateResult(double allCalculateResult) {
        this.allCalculateResult = allCalculateResult;
    }

    public String compileFuzzyFactors() {
        return distanceFuzzy + negativeFactorsFuzzy + valuesFuzzy;
    }

    public boolean addDayFactor(String day, Integer value) {
        boolean result = false;
        try {
            daysMap.put(day, value);
            result = true;
        } catch (Exception ex) {
            result = false;
        }
        return result;
    }

    public int getCurrentDayValue() {
        int result = 0;
        String dayName;
        try {
            dayName = PrognosisFunction.days[Calendar.getInstance().get(Calendar.DAY_OF_WEEK)];
            if (daysMap.containsKey(dayName)) {
                result = daysMap.get(dayName);
            } else {
                result = 0;
            }
        } catch (Exception ex) {
            result = 0;
        }
        return result;
    }

    public int getDayValue(int dayIndex) {
        int result = 0;
        String dayName;
        try {
            dayName = PrognosisFunction.days[dayIndex];
            if (daysMap.containsKey(dayName)) {
                result = daysMap.get(dayName);
            } else {
                result = 0;
            }
        } catch (Exception ex) {
            result = 0;
        }
        return result;
    }
}
